//
//  DPWalletFlowModel.swift
//  DoctorEPlus
//
//  Created by 王林波 on 2021/3/15.
//

import UIKit

class DPWalletFlowModel: NSObject {
    var month: String = ""
    var inTotalAmount: String = ""
    var outTotalAmount: String = ""
    
    var itemArray: [DPWalletFlowItemModel] = []
    
    
}

class DPWalletFlowItemModel: NSObject {
   
    var title: String = ""
    var amount: String = ""
    var time: String = ""
    var balance: String = "" // 余额
    var date: String = "" // 入账时间
    var alipayNo: String = "" // 单号 // orderNo
    var billId: String = "" // id
    var reason: String = ""
    
    var type: Int = 0 // 1收入  2支出
    var balanceStatus: Int = 0 // 用户提现状态 1-审核中 2-已到账 3 -提现失败
    var nameType: Int = 0 // type 类型 1-提现 2-新用户奖励 3-拉新奖励 4-趣玩收入

    
    
    func parseDic(_ dic: [String: Any]) {
        
        self.title = BHJsonTool.decodeStringFromDic(dic: dic, key: "reason")
        self.amount = BHJsonTool.decodeStringFromDic(dic: dic, key: "amount")
        self.time = BHJsonTool.decodeStringFromDic(dic: dic, key: "time")
        self.reason = BHJsonTool.decodeStringFromDic(dic: dic, key: "reason")
        self.balance = BHJsonTool.decodeStringFromDic(dic: dic, key: "balance")
        self.date = BHJsonTool.decodeStringFromDic(dic: dic, key: "operateTime")
        self.alipayNo = BHJsonTool.decodeStringFromDic(dic: dic, key: "no")
        self.billId = BHJsonTool.decodeStringFromDic(dic: dic, key: "id")

        self.type = BHJsonTool.decodeIntFromDic(dic: dic, key: "fundType")
        self.balanceStatus = BHJsonTool.decodeIntFromDic(dic: dic, key: "balanceStatus")
        self.nameType = BHJsonTool.decodeIntFromDic(dic: dic, key: "type")

    }
    
    lazy var typeName: String = {
        if self.nameType == 1 {
            return "提现"
        }else if self.nameType == 2 {
            return "新用户奖励"
        }else if self.nameType == 3 {
            return "拉新奖励"
        }else if self.nameType == 4 {
            return "趣玩收入"
        }else {
            return ""
        }
    }()
    
    lazy var balanceStateName: String = {
        if self.balanceStatus == 1 {
            return "审核中"
        }else if self.balanceStatus == 2 {
            return "已到账"
        }else if self.balanceStatus == 3 {
            return "提现失败"
        }else {
            return ""
        }
    }()
    
}
